﻿<UserControl
    x:Class="yavc.Metro.Controls.ZoneControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:yavc.Metro.Controls"
    xmlns:conv="using:yavc.Metro.Converters"
    x:Name="zc">
    <UserControl.Resources>
        <Style x:Key="zcTextBase" TargetType="TextBlock" BasedOn="{StaticResource MetroTextBase}">
            <Setter Property="HorizontalAlignment" Value="Left" />
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="Margin" Value="5,3" />
            <Setter Property="TextWrapping" Value="Wrap" />
        </Style>
    </UserControl.Resources>

    <Grid HorizontalAlignment="Stretch">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        
        <Image 
            VerticalAlignment="Center"
            Source="{Binding ImageUri, Converter={StaticResource imgConv}}"
            Height="{Binding ElementName=zc, Path=ImageSize}"
            Width="{Binding ElementName=zc, Path=ImageSize}"
            Margin="{Binding ElementName=zc, Path=ImageSize, Converter={StaticResource margScale}}" />
        
        <TextBlock Grid.Column="1"
            Text="{Binding InputTitle}" FontWeight="Bold" HorizontalAlignment="Center"
            Style="{StaticResource zcTextBase}"
            FontSize="{Binding ElementName=zc, Path=LargeFontSize}" />

        <Button Grid.Column="2" Click="TogglePower_Click" Style="{StaticResource MetroClearButtonStyle}" 
                    VerticalAlignment="Center" HorizontalAlignment="Right" >
            <Grid
                       Height="50"
                       Width="50">
                <Rectangle RadiusY="3.75"
                                 RadiusX="3.75"
                                 Fill="{StaticResource MetroChromeBrush}" />
                <Rectangle RadiusY="3.75"
                                 RadiusX="3.75"
                                 StrokeThickness="0.2"
                                 Stroke="{StaticResource MetroForegroundBrush}" />
                <Rectangle x:Name="indicatorLight"
                                     RadiusY="3.75"
                                     RadiusX="3.75"
                                     Margin="3,6"
                                     StrokeThickness="0.5"
                                     Height="8"
                                     VerticalAlignment="Top"
                                     Fill="{Binding IsOn, Converter={StaticResource colBoolPowerButton}}" />
                <TextBlock
                                    Text="{Binding IsOnString}"
                                    TextAlignment="Center"
                                    HorizontalAlignment="Center"
                                    VerticalAlignment="Center"
                                    FontSize="20" />
            </Grid>
        </Button>

        <TextBlock 
            Text="{Binding DSPTitle}" Grid.Row="1" Grid.ColumnSpan="3"
            Style="{StaticResource zcTextBase}" FontWeight="Bold"
            HorizontalAlignment="Center"
            FontSize="{Binding ElementName=zc, Path=MediumFontSize}" />
    </Grid>
</UserControl>
